Skip to content

Conversation

weinbe58
Copy link
Member

Closes #508 however I am not sure where to reexport new since I Can't reexport it into the qubit module. For now I have re-exported it into squin.new.

@weinbe58 weinbe58 linked an issue Sep 30, 2025 that may be closed by this pull request
3 tasks
Copy link

codecov bot commented Sep 30, 2025

Codecov Report

❌ Patch coverage is 90.69767% with 8 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/bloqade/cirq_utils/emit/base.py 88.00% 3 Missing ⚠️
src/bloqade/squin/stdlib/qubit.py 62.50% 3 Missing ⚠️
src/bloqade/squin/qubit.py 93.33% 1 Missing ⚠️
src/bloqade/squin/rewrite/wrap_analysis.py 50.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Contributor

github-actions bot commented Sep 30, 2025

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
9459 8354 88% 0% 🟢

New Files

File Coverage Status
src/bloqade/squin/stdlib/qubit.py 63% 🟢
TOTAL 63% 🟢

Modified Files

File Coverage Status
src/bloqade/cirq_utils/emit/base.py 93% 🟢
src/bloqade/cirq_utils/emit/qubit.py 100% 🟢
src/bloqade/cirq_utils/lowering.py 93% 🟢
src/bloqade/pyqrack/squin/qubit.py 96% 🟢
src/bloqade/rewrite/passes/aggressive_unroll.py 100% 🟢
src/bloqade/squin/_init_.py 100% 🟢
src/bloqade/squin/analysis/address_impl.py 100% 🟢
src/bloqade/squin/groups.py 100% 🟢
src/bloqade/squin/qubit.py 98% 🟢
src/bloqade/squin/rewrite/wrap_analysis.py 86% 🟢
src/bloqade/squin/stdlib/broadcast/noise.py 74% 🟢
src/bloqade/stim/passes/flatten.py 100% 🟢
src/bloqade/stim/passes/squin_to_stim.py 100% 🟢
TOTAL 95% 🟢

updated for commit: 15366cb by action🐍

@weinbe58 weinbe58 marked this pull request as draft September 30, 2025 20:11
@david-pl
Copy link
Collaborator

david-pl commented Oct 1, 2025

@weinbe58 I thought this was meant to replace the qubit.New statement altogether. If so, then just replace the wrapper by the stdlib function in qubit.new.

@weinbe58 weinbe58 marked this pull request as ready for review October 1, 2025 15:34
@weinbe58
Copy link
Member Author

weinbe58 commented Oct 1, 2025

@weinbe58 I thought this was meant to replace the qubit.New statement altogether. If so, then just replace the wrapper by the stdlib function in qubit.new.

either way I need to put the new stdlib function outside of the qubit.py module because otherwise it will create a circular import

@weinbe58
Copy link
Member Author

weinbe58 commented Oct 6, 2025

TODO:

  • rename new to qalloc
  • Remove analysis for ilist.map for now, create another PR later.

@weinbe58 weinbe58 added the breaking breaking changes or proposed changes that would break existing APIs label Oct 6, 2025
@weinbe58 weinbe58 added the do not merge do not merge pending on other issues to resolve label Oct 6, 2025
@weinbe58 weinbe58 requested a review from david-pl October 17, 2025 10:09
Copy link
Collaborator

@david-pl david-pl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, I just have some minor comments and questions.
FYI, I also checked to make sure that the examples in the documentation still work after this change.

new_func = func.Function(
sym_name=sym_name, body=callable_region, signature=new_signature
)
mt_ = ir.Method(None, None, sym_name, [], mt.dialects, new_func)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I admit to being a bit lost here. Why is it necessary to construct a new method like this here? Why is mt_ = mt.similar(mt.dialects) not sufficient?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The signature is different, I removed all the arguments of the function.

def get_measurement_id(measurement: MeasurementResult) -> int: ...


# TODO: investigate why this is needed to get type inference to be correct.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth considering this as part of #549, since depending on the changes there, MeasureQubit and MeasureQubitList may be consolidated.

cc @johnzl-777

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is a bit old now isn't it? I'm all for getting this in first and then I can make the necessary tweaks in a dedicated PR for #549 .

The request for changes might take a bit considering Phillip's in Munich for the Munich Quantum Software Forum

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment here is more on the Kirin side of things.

In principle the statements typing should just work as it but for some reason it wasn't so I added an explicit type inference method

def get_measurement_id(measurement: MeasurementResult) -> int: ...


# TODO: investigate why this is needed to get type inference to be correct.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment here is more on the Kirin side of things.

In principle the statements typing should just work as it but for some reason it wasn't so I added an explicit type inference method

@weinbe58 weinbe58 merged commit 19dd7b3 into main Oct 18, 2025
11 checks passed
@weinbe58 weinbe58 deleted the phil/508-simplifying-qubitnew branch October 18, 2025 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking breaking changes or proposed changes that would break existing APIs do not merge do not merge pending on other issues to resolve

Projects

None yet

Development

Successfully merging this pull request may close these issues.

simplifying qubit.new

4 participants